<?php
	include ('lib/twitese.php');
	$title = 'Express';
		ob_start();
	if(!isset($_SESSION)){
		session_start();
	}
	if (!loginStatus()) header('location: login.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="rabr, open source, php, twitter, oauth, disinfeqt" />
<meta name="description" content="Revolutionary Interface for Twitter" />
<link rel="shortcut icon" href="img/favicon.ico" />
<link type="text/css" id="css" href="css/main.css?ver=2010041607" rel="stylesheet" />
<title>Rabr / <?php echo $title ?></title>
<?php 
	$myCSS = isset($_COOKIE['myCSS']) ? $_COOKIE['myCSS'] : '';
	$old_css = 'ul.sidebar-menu li.active a';
	$new_css = 'ul.sidebar-menu a.active';
	$myCSS = str_replace($old_css,$new_css,$myCSS);
	$fontsize = isset($_COOKIE['fontsize']) ? $_COOKIE['fontsize'] : '13px';
	$ad_display = 'block';
	$bodyBg = isset($_COOKIE['bodyBg']) ? $_COOKIE['bodyBg'] : '';
?>
<style type="text/css">
<?php echo $myCSS ?>
a:active, a:focus {outline:none}
body {font-size:<?php echo $fontsize ?> !important;background-color:<?php echo $bodyBg ?>}
</style>
<script type="text/javascript" src="js/jquery.js?ver=1.4.2"></script>
<script type="text/javascript" src="js/jquery.plugins.js?ver=2010033101"></script>
<script type="text/javascript" src="js/public.js?ver=2010041604"></script>
<script type="text/javascript" src="js/ajaxfileupload.js"></script>
</head>
<body>
<div id="shortcutTip" style="display:none"></div>
	<div id="header">
		<div class="wrapper">
			<a href="index.php"><img id="logo" style="float:left" src="img/logo.png" /></a>
			<ul id="nav" class="round">
				<li><a href="index.php">Home</a></li>
				<li><a href="profile.php">Profile</a></li>
				<li><a href="browse.php">Public</a></li>
				<li><a href="setting.php">Settings</a></li>
				<li><a href="logout.php">Logout</a></li>			
			</ul>
		</div>
	</div>
	<div id="content">
		<div class="wrapper">
			<div class="content-bubble-arrow"></div>
				<table cellspacing="0" class="columns">
					<tbody>
						<tr>
							<td id="left" class="column round-left">
								
<div id="statuses" class="column round-left">
	
	<!--sendform-->

<form enctype="multipart/form-data" action="ajax/uploadPhoto.php" method="post" id="photoArea">
<span style="font-weight: bold;">Upload Image</span>
<p>Powered by Img.ly</p>
<input type="file" name="image" id="imageFile"/> 
<input type="submit" id="imageUploadSubmit" class="btn" value="Upload"/>
<a href="#" onclick="$('#photoArea').slideToggle(300)" title="Close" class="close"></a>
</form>

<script type="text/javascript" src="js/formfunc.js?ver=2010041501"></script>
<?php if (!isset($_sentText)) { ?>
<h2>What's happening?</h2>
<span id="tip"><b>140</b></span>
<?php } ?>


<form id="symArea">
<div id="symbols">
<?php include ('inc/symbols.php');?>
</div>
<a class="close" title="Close" onclick="$('#symArea').slideToggle(300)" href="#"></a>
</form>

<form id="transArea">
<span style="font-weight: bold; display: block; margin-bottom: 5px;">Translation Settings</span>
<p>Translate my tweets into <select name="myLangs" style="border: 1px solid rgb(170, 170, 170); margin-top: 5px; padding: 1px 2px;">
<option value="ar">Arabic</option>
<option value="zh-CN">¼󍦖ю¼/option>
<option value="zh-TW">·±򸗐τ</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option value="en">English</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="lt">Lithuanian</option>
<option value="no">Norwegian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ru">Russian</option>
<option value="es">Spanish</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
</select>
<input type="button" value="Translate" class="btn" id="translateMy" style="vertical-align: middle; padding: 3px 8px; margin-top: -3px;">
</p>
<a href="#" onclick="$('#transArea').slideToggle(300)" title="Close" style="right:25px;top:5px;" class="close"></a>
</form>

<form action="index.php" method="post">
<a id="transRecover">Restore</a>
<textarea name="status" id="textbox"><?php if (isset($_sentText)) echo $_sentText ?></textarea>
<input type="hidden" id="in_reply_to" name="in_reply_to" value="<?php echo isset($_sentInReplyTo) ? $_sentInReplyTo : 0 ?>" />
<?php
	$t = getTwitter();
	$current_user = $t->veverify();
	if ($current_user === false) {
		header('location: error.php');
	} 
	$empty = count($current_user) == 0? true: false;
	if ($empty) {
		echo "<div id=\"currently\">
			<span id=\"full_status\" title=\"Click to view the full tweet\"><strong >Latest:</strong></span>
			<span id=\"latest_status\">
			<span id=\"latest_text\">
			<span class=\"status-text\">What's shaking?</span>
			<span class=\"full-text\" style=\"display:none\">What's shaking?</span>
			<span class=\"entry-meta\" id=\"latest_meta\"></span>
			<span class=\"entry-meta\" id=\"full_meta\"></span>
			</span>
			</span>
			</div>";
	} else {
			$status = $current_user->status;
			$date = formatDate($status->created_at);
			$text = formatText($status->text);
			$output = "
				<div id=\"currently\">
				<span id=\"full_status\"><strong>Latest:</strong></span>
				<span id=\"latest_status\">
				<span id=\"latest_text\">
				<span class=\"status-text\">" . $text . "</span>
				<span class=\"full-text\" style=\"display:none\">" . $text . "</span>
				<span class=\"entry-meta\" id=\"latest_meta\"><a href=\"status.php?id=$status->id\" target=\"_blank\">" . $date . "</a></span>
				<span class=\"entry-meta\" id=\"full_meta\" style=\"display:none\"><a href=\"status.php?id=$status->id\" target=\"_blank\">" . $date . "</a></span>
				</span>
				</span>
				</div>
				";
		echo $output;
	}
?>
<div id="tweeting_controls">
		<a class="a-btn a-btn-m btn-disabled" id="tweeting_button" tabindex="2" href="#"><span>Tweet</span></a>
	</div>
<!--<input type="submit" id="submit_btn" value="update" />-->
	<div id="func_set">
	
	<a class="func_btn" href="javascript:shortUrlDisplay();" title="Shorten URL" style="background-position:-238px -113px">Shorten URL</a>
	
	<a class="func_btn" href="javascript:shortenTweet();" title="Shorten Tweet" style="background-position:-222px -48px;">Shorten Tweet</a>
	
	<a id="transBtn" title="Translation Settings" class="func_btn" style="background-position:-110px -80px;">Translate</a>
	
	<a title="Upload Image" id="photoBtn" class="func_btn" style="background-position: -207px -128px;">Image</a>
	
	<a title="Sogou Cloud IME" href="javascript:void((function(){var%20n=navigator.userAgent.toLowerCase();ie=n.indexOf('msie')!=-1?1:0;if(document.documentMode)ie=0;charset='';if(ie)charset=document.charset;src=ie&amp;&amp;charset=='utf-8'?'http://web.pinyin.sogou.com/web_ime/init2_utf8.php':'http://web.pinyin.sogou.com/web_ime/init2.php';element=document.createElement('script');element.setAttribute('src',src);document.body.appendChild(element);})())" onclick="updateSentTip('Loading...', 5000, 'ing')" class="func_btn" style="background-position: -62px -112px;">Sogou</a>
	
	<a id="symbolBtn" title="Symbols and smileys" class="func_btn" style="background-position: -206px -113px;">Symbols</a>

	<a id="restoreBtn" style="background-position: 2px -64px;" class="func_btn" title="Restore previous tweet">Restore</a>

	</div>
	</form>
	<div class="clear"></div>

<!--sidebar-->
<td class="column round-right" id="side_base">
<div id="side" class="round-right">
	<div id="sideinfo">
		<a href="profile.php"><img id="sideimg" src="<?php echo getCookie("imgurl")?>" />
		<span id="sideid"><?php echo getEncryptCookie('twitese_name')?></span>
		<span id="me_tweets"><span id="update_count"><?php echo getCookie('statuses_count')?></span> tweets</span>
		</a>
	</div>
	<ul id="user_stats">
		<li>
			<a href="friends.php">
				<span class="count"><?php echo getCookie('friends_count')?></span>
				<span class="label">following</span>
			</a>
		</li>
		<li>
			<a href="followers.php">
				<span class="count"><?php echo getCookie('followers_count')?></span>
				<span class="label">followers</span>
			</a>
		</li>
		<li>
			<a href="lists.php">
				<span class="count"><?php $listed_count = getCookie('listed_count'); echo ($listed_count > 0 ? $listed_count : 0);?></span>
				<span class="label">listed</span>
			</a>
		</li>
	</ul>
	<hr />
	<div class="clear"></div>
		<ul id="primary_nav" class="sidebar-menu">
	<li id="replies_tab"><a class="in-page-link" href="replies.php"><span>@<?php echo is_null(getEncryptCookie('twitese_name')) ? $t->screen_name : getEncryptCookie('twitese_name'); ?></span></a></li>
	<li id="msgs_tab"><a class="in-page-link" href="message.php"><span>Direct Messages</span></a></li>
</ul>
</div></td>
</div>
<!--footer-->
<?php include ('inc/footer.php'); ?>